#ifndef GLCHILDCSG_H
#define GLCHILDCSG_H

#include "glchild.h"
#include "../csggrapher.h"

enum DRAW_FLAG
{
    DRAW_GRIDS           = 1,
    DRAW_CTRL_POLYGON    = 2,
    DRAW_BOUNDING_BOX    = 4,
    DRAW_NAIVELY         = 8,
    DRAW_CASTELJAU       = 16,
    DRAW_EMPTY_TEST      = 32,
    DRAW_SINGULAR_BOXES  = 64,
    DRAW_INNER_BOXES     = 128,
    DRAW_BOUND_BOXES     = 256,
    DRAW_SELECTING_BOX   = 512,
    DRAW_CIA             = 1024,
    DRAW_HIA             = 2048,
    DRAW_DOMAIN          = 4096,
    DRAW_STAR_TEST       = 8192,
    DRAW_BOX_DOMAIN      = 16384,
    DRAW_CONTOUR         = 32768,
//    DRAW_NCAD            = 65536,
//    DRAW_NCAD_SC         = 131072,
//    DRAW_OTHERS          = 262144,
    DRAW_FLAG_END
};

class GLChildCSG : public GLChild
{
    Q_OBJECT

public:
    GLChildCSG();
    ~GLChildCSG();

    bool loadFile(const QString &fileName);

    void showBoundingBox();
    void showCtrlPoly();
    void showContour();
    void showNaive();
    void showCasteljau();

    virtual void resetView();

    CSGGrapher * getGrapher(){return grapherChild;}
    Box * getTestBox(){return &testedBox;}

protected slots:
    void testFinished();

protected:
    virtual void paintGL();

    void drawSelectingBox();

    // camera
    void ViewAll(bool check_first = true);

    Box testedBox;
    CSGGrapher * grapherChild;
};

#endif
